﻿using System;
using GpgCore.GameWorld;
using GpgCore.Maps;
using Microsoft.Xna.Framework;

namespace GpgCore
{
    public class World
    {
        public DateTime CurrentDate;
        public Planet Planet;

        public static World Instance;

        protected World(string planetName, DateTime startDate)
        {
            Instance = this;
            CurrentDate = startDate;
            Planet = new Planet {Name = planetName};
        }
        protected World(string planetName, DateTime startDate, Point mapSize)
        {
            Instance = this;
            CurrentDate = startDate;
            Planet = new Planet {Name = planetName};
            Planet.PlanetMap = new PlanetMap(mapSize.X, mapSize.Y);
            foreach (var cell in Planet.PlanetMap.Cells)
                cell.CellType = PlanetMapCellType.Plains;
        }

        public void NextTurn()
        {
            CurrentDate = CurrentDate.AddDays(1);
            Planet.NextTurn();
        }

        public static void NewGame(string planetName, DateTime startDate, Point mapSize)
        {
            new World(planetName, startDate, mapSize);
        }
    }
}
